<!DOCTYPE HTML>
<html lang="zh-CN" class="ua-windows ua-webkit">
<head>
<meta charset="UTF-8">
<meta content="" name="description">
<title>session数据查询</title>
<style>

table.tbl{
    background: #000;
}

table.tbl th{
    background: #555;
}
table.tbl tr{
    background: #fff;
}

</style>
</head>
<body>
<p><b>这是一个session用户主动变换query数据的查询demo, 目前按单字粒度索引, 数据有 {{ rnum }}, 支持复杂的查询逻辑。</b></p>

<form action="/sessiondata/search" method="get">
<table>
<tbody>
<tr>
    <td> 原始query(@oquery):</td>
    <td><input type="text" name="oquery" value="{{ params.oquery }}" size="80"/></td>
</tr>
<tr>
    <td> 变换query(@query):</td>
    <td><input type="text" name="query" value="{{ params.query }}" size="80" /></td>
</tr>
<tr>
    <td valign="top" with="5%">
        检索表达式:
    </td>
    <td>
        <textarea name="queryexp" cols="40" rows="5">{{ params.queryexp }}</textarea>
    </td> 
</tr>
<tr>
    <td>&nbsp;</td>
    <td><input type="submit" value="提交" /> <input type="button" value="清空" onclick="this.form.oquery.value='';this.form.query.value='';this.form.queryexp.value=''" /></td>
</tr>
{% if queryexp %}
<tr>
    <td colspan="4">
        <p>当前检索表达式: </p> 
        <p><b>{{ queryexp }}</b> </p>
    </td>
</tr>
{% endif %}
<tr>
    <td colspan="4">
        <p>支持复杂的查询表达式: </p> 
        <p><b>@oquery 宝宝  @query 小孩 | 婴儿</b> </p> 
        <p><b>@oquery "费曼" 物理学 @query "费恩曼" 物理学</b> </p> 
        <p><a href="http://sphinxsearch.com/docs/2.0.3/extended-syntax.html" target="_blank">更多查询类型支持</a></p>
    </td>
</tr>
</tbody>
</table>

{% if result %}

<table with="80%" border="0" cellpadding="2" cellspacing="1" class="tbl">
<tbody>
<tr>
    <th>原始query @oquery</th><th>变换query @query</th><th>频次 freq</th>
</tr>
{% for match in matches %}
<tr>
     <td>{{ match.0|safe }}</td><td>{{ match.1|safe }}</td><td>{{ match.2|safe }}</td>
</tr>
{% endfor%}
</tbody>
</table>
{% endif %}
</form>

<p align="center"><b>Power by Sphinx, Tokyo Tyrant, Django, Python</p></b>

</body>
</html>
